package com.itheima.Demobaozi;

public class chihuo implements Runnable {
    @Override
    public void run() {
        while (true) {
            synchronized ("锁") {
                //判断
                if (Demobz.b.flag == false) {
                    try {
                        "锁".wait();
                    } catch (InterruptedException e) {


                    }
                } else {
                    System.out.println("拜清清吃了个" + Demobz.b.pi + "皮" + Demobz.b.xian + "馅的大包子");

                    //这时候就要修改状态了;
                    Demobz.b.pi = null;
                    Demobz.b.xian = null;
                    Demobz.b.flag = false;
                    "锁".notify();

                }
            }
        }
    }
}
